<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" xml:lang="pt" lang="pt-br">

<f:view contentType="text/html">
	<h:head>
		<f:facet name="first">
			<meta http-equiv="X-UA-Compatible" content="EmulateIE8" />
			<meta content='text/html; charset=UTF-8' http-equiv="Content-Type" />
			<title>Sos:Reserva</title>
		</f:facet>
		<h:outputStylesheet name="css/default.css" />
		<h:outputStylesheet name="css/estilo.css" />
		<h:outputScript name="locale-primefaces.js" library="js" />
	</h:head>
	<h:body>
		<div id="global">
			<p:layout fullPage="true">

				<p:layoutUnit id="bottom" position="south" size="30">
					<ui:include src="../rodape.xhtml" />
				</p:layoutUnit>

				<p:layoutUnit id="center" position="center">

					<div id="menu">
						<ui:include src="../menu.xhtml" />
					</div>

					<div id="corpo">

						<h:form id="reserva" >
							<p:panel header="Reserva de Sala" id="panelcorpo" style="box-shadow: 2px 9px 15px 1px #888;">
								<h:panelGrid>
									<h:outputText value="Responsavel: " />
									<p:autoComplete value="#{reservaManager.usuario}" id="prof" required="true"
										completeMethod="#{reservaManager.buscaPorNome}" var="p" label="Responsavel"
										itemLabel="#{p.nome}" itemValue="#{p}" forceSelection="true"
										minQueryLength="3" />

									<h:panelGroup>
										<h:outputText value="Sala: " />
										<br/>
										<p:inputText id="sala"
											value="#{reservaManager.reserva.sala.nome}" size="5"
											required="true" requiredMessage="Selecione uma sala"
											disabled="true" />

										<p:commandButton value="Selecionar" process="@this"
											actionListener="#{reservaManager.carregaPesquisa}"
											update=":pesqSalaDialogForm :salas"
											oncomplete="pesqSalaDialogWidget.show();" />
									</h:panelGroup>

									<h:outputText value="Dia: " />
									<p:calendar value="#{reservaManager.dia}" pattern="MM/dd/yyyy"
										disabled="true" locale="pt" />

									<h:outputText value="Hora Inicial: " />
									<p:calendar value="#{reservaManager.reserva.dataInicial}"
										pattern="HH:mm" timeOnly="true" disabled="true" locale="pt"/>

									<h:outputText value="Hora Final: " />
									<p:calendar value="#{reservaManager.reserva.dataFinal}"
										pattern="HH:mm" timeOnly="true" disabled="true" locale="pt"/>

									<h:outputText value="Observação: " />
									<h:inputTextarea value="#{reservaManager.reserva.observacao}"
										cols="50" rows="7" />

									<h:panelGroup>
									
										<p:commandButton style="float:right;" value="Cancelar" immediate="true"
											action="#{reservaManager.cancelaReserva}" ajax="false" />

										<p:commandButton style="float:right;" value="Reservar"
											action="#{reservaManager.reservarSala}" update=":reserva" />
									
									</h:panelGroup>
									
								</h:panelGrid>
							</p:panel>
							<p:messages id="mensagemReserva" showDetail="false" ></p:messages>
						</h:form>
					</div>
				</p:layoutUnit>
			</p:layout>
		</div>
		<ui:include src="pesqSalas.xhtml" />
	</h:body>

</f:view>
</html>